package com.jun.feign.controller;

import com.jun.feign.entity.User;
import com.jun.feign.service.HelloService;
import com.jun.feign.service.RefactorHelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述:
 *
 * @outhor jun
 * @create 2018-04-27 11:12
 */
@RestController
public class ConsumerController {
    @Autowired
    HelloService helloService;

    @Autowired
    RefactorHelloService refactorHelloService;

    @RequestMapping( value = "/feign-consumer" ,method = RequestMethod.GET)
    public String helloConsumer(){
        return helloService.hello();
    }

    @RequestMapping(value = "/feign-consumer2" , method = RequestMethod.GET)
    public String helloConsumer2(){
        StringBuilder sb = new StringBuilder();
        sb.append(helloService.hello()).append("\n");
        sb.append(helloService.hello("DIDI")).append("\n");
        sb.append(helloService.hello("DIDI" , 30)).append("\n");
        sb.append(helloService.hello(new User( "DIDI" , 30))).append("\n");
        return sb.toString();
    }

    @RequestMapping(value = "/feign-consumer3" , method = RequestMethod.GET)
    public String helloConsumer3(){
        StringBuilder sb = new StringBuilder();
        sb.append(helloService.hello()).append("\n");
        sb.append(helloService.hello("MIMI")).append("\n");
        sb.append(helloService.hello("MIMI" , 30)).append("\n");
        sb.append(helloService.hello(new User( "MIMI" , 30))).append("\n");
        return sb.toString();
    }
}
